<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
	<head>
		<title><?php echo TITREBO ?> - <?php echo trad($this -> titre, APPLNG) ?></title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="description" content="" />
		<meta name="keywords" content="" />
		<meta name="author" content="webz0ne 1996 - <?php echo date('Y') ?>" />
		<link rel="shortcut icon" href="<?php echo URL_SITE ?>img/cdg.ico" type="image/x-icon" />
		<script>
			var pagetpl = '<?php echo $GLOBALS["page"] ?>';
			var applng = '<?php echo APPLNG ?>';
			var pathToImages = '<?php echo URL_SITE ?>img/';
		</script>
		<link type="text/css" rel="stylesheet" media="all" href="<?php echo URL_SITE ?>css/css.php?<?php echo time() ?>" />
		<link href="<?php echo URL_SITE ?>css/dhtmlgoodies_calendar.css?<?php echo time() ?>" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js?<?php echo time() ?>"></script>
		<script type="text/javascript" src="<?php echo URL_SITE ?>js/js.php?<?php echo time() ?>"></script>
		<script src="<?php echo URL_SITE ?>js/dhtmlgoodies_calendar.js?<?php echo time() ?>" type="text/javascript"></script>
	</head>
	<body>
		<form id="chnlng" method="post" action="<?php echo URL_SITE ?>">
			<input type="hidden" id="redir" name="redir" value="<?php echo REQUESTURI ?>" />
			<input type="hidden" id="setlng" name="setlng" value="" />
			<input type="hidden" id="oldlng" name="oldlng" value="<?php echo APPLNG ?>" />
		</form>
		<div id="header">
			<div id="headercontenu">
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td width="50%"  style="text-align: left;" valign="middle">
						<a href="<?php echo URL_SITE ?>">
							<img src="<?php echo URL_SITE ?>img/cdg.png" alt="<?php echo TITREBO ?>" title="<?php echo TITREBO ?>" border="0" />
						</a>
						<br />
						<span onclick="go('<?php echo URL_SITE ?>');" class="bologo">
							<img src="<?php echo URL_SITE ?>?blackttf=1&txt=BACKOFFICE&tp=18" alt="BACKOFFICE" title="BACKOFFICE" />
						</span>
					</td>
					<td width="50%" style="text-align: right;">
						<img src="<?php echo URL_SITE ?>img/drapeaux/fr.png" alt="<?php echo trad('Français', APPLNG) ?>" title="<?php echo trad('Français', APPLNG) ?>" style="cursor: pointer; visibility: <?php if (APPLNG <> 'fr'): ?>visible<?php else: ?>hidden<?php endif; ?>;" onclick="changelng('fr');" />&nbsp;
						<img src="<?php echo URL_SITE ?>img/drapeaux/gb.png" alt="<?php echo trad('Anglais', APPLNG) ?>" title="<?php echo trad('Anglais', APPLNG) ?>" style="cursor: pointer; visibility: <?php if (APPLNG <> 'en'): ?>visible<?php else: ?>hidden<?php endif; ?>;" onclick="changelng('en');" />&nbsp;
						<img src="<?php echo URL_SITE ?>img/drapeaux/de.png" alt="<?php echo trad('Allemand', APPLNG) ?>" title="<?php echo trad('Allemand', APPLNG) ?>" style="cursor: pointer; visibility: <?php if (APPLNG <> 'de'): ?>visible<?php else: ?>hidden<?php endif; ?>;" onclick="changelng('de');" />&nbsp;
						<img src="<?php echo URL_SITE ?>img/drapeaux/es.png" alt="<?php echo trad('Espagnol', APPLNG) ?>" title="<?php echo trad('Espagnol', APPLNG) ?>" style="cursor: pointer; visibility: <?php if (APPLNG <> 'es'): ?>visible<?php else: ?>hidden<?php endif; ?>;" onclick="changelng('es');" />
						<?php if(get_s("bo_user") > 0): ?>
						<br />
						<?php if ($GLOBALS["page"] <> 'accueil' && $GLOBALS["page"] <> 404):  ?>
						<a href="<?php echo rw('accueil') ?>"><?php echo trad('Tableau de bord', APPLNG) ?></a>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<?php endif; ?>
						<a href="<?php echo URL_SITE ?>?logout=1"><?php echo trad('Se déconnecter', APPLNG) ?></a>
						<?php endif; ?>
					</td>
				</tr>
				</table>
			</div>
		</div>
		<div class="sep"></div>
		<div id="contenu">
<?php if ($this -> etat_stock == 1): ?>
	<center>
		<img src="<?php echo URL_SITE ?>?titrettf=1&txt=<?php echo trad('ETAT DES STOCKS', APPLNG) ?>" alt="<?php echo trad('ETAT DES STOCKS', APPLNG) ?>" title="<?php echo trad('ETAT DES STOCKS', APPLNG) ?>" />
	</center>
	<div class="sep"></div>
	<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('GLOBAL PAR ECHANTILLON', APPLNG) ?>&fc=0,0,0&bc=255,255,255&tp=15" alt="<?php echo trad('GLOBAL PAR ECHANTILLON', APPLNG) ?>" title="<?php echo trad('GLOBAL PAR ECHANTILLON', APPLNG) ?>" style="padding: 5px; border: solid 1px;" />
	
	<div class="sep"></div>
	
	<table class="liste">
	<thead>
		<tr>
			<th style="text-align: center;"><?php echo trad('Echantillon', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Stock initial', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons envoyés', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons restants', APPLNG) ?></th>
		</tr>
	</thead>
	<tbody>
		<?php $i = 0; ?>
		<?php $totalstock_sample = 0; ?>
		<?php $totalused_sample = 0; ?>
		<?php $totaldifferential_sample = 0; ?>
		<?php foreach($this -> par_echantillon as $ligne): ?>
		<tr class="<?php if ($i++ % 2 <> 0): ?>im<?php endif; ?>pair">
			<td style="text-align: center;"><?php echo sl($ligne["name"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_stock"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_used"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_remaining"]) ?></td>
		</tr>
		<?php $totalstock_sample += $ligne["total_stock"]; ?>
		<?php $totalused_sample += $ligne["total_used"]; ?>
		<?php $totaldifferential_sample += $ligne["total_remaining"]; ?>
		<?php endforeach; ?>
		<tr class="total">
			<td style="text-align: center;"><?php echo trad("TOTAL", APPLNG) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sample) ?></td>
		</tr>
	</tbody>
	</table>
	<div class="sep"></div>
	<div style="text-align: right">
		<u><strong><?php echo trad('Exporter', APPLNG) ?></strong></u>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=par_echantillon&type_export=xls') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/xls.png" title="Excel" alt="Excel" /></a>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=par_echantillon&type_export=pdf') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/pdf.png" title="PDF" alt="PDF" /></a>
	</div>
	<div class="sep"></div>
	
		<?php foreach($this -> par_echantillon as $ligne): ?>
		<center>
			<?php 
				$camembert = new GP_Graph(); 
				
				$donnees = array(
					$ligne["total_used"],
					$ligne["total_remaining"]
				);
				
				$legendes = array(
					trad('Echantillons envoyés', APPLNG)." [".$ligne["total_used"]."]",
					trad('Echantillons restants', APPLNG)." [".$ligne["total_remaining"]."]"
				);
				
				$titre = trad("Etat des stocks pour", APPLNG)." ".sl($ligne["name"]);
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<?php endforeach; ?>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(
					$totalused_sample,
					$totaldifferential_sample
				); 
				
				$legendes = array(
					trad('Echantillons envoyés', APPLNG)." [".$totalused_sample."]",
					trad('Echantillons restants', APPLNG)." [".$totaldifferential_sample."]"
				); 
				
				$titre = trad("Etat global des stocks", APPLNG);
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	
	<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('GLOBAL PAR PAYS', APPLNG) ?>&fc=0,0,0&bc=255,255,255&tp=15" alt="<?php echo trad('GLOBAL PAR PAYS', APPLNG) ?>" title="<?php echo trad('GLOBAL PAR PAYS', APPLNG) ?>" style="padding: 5px; border: solid 1px;" />
	
	<div class="sep"></div>
	
	<table class="liste">
	<thead>
		<tr>
			<th style="text-align: center;"><?php echo trad('Pays', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Stock initial', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons envoyés', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons restants', APPLNG) ?></th>
		</tr>
	</thead>
	<tbody>
		<?php $i = 0; ?>
		<?php $totalstock_country = 0; ?>
		<?php $totalused_country = 0; ?>
		<?php $totaldifferential_country = 0; ?>
		<?php foreach($this -> par_pays as $ligne): ?>
		<tr class="<?php if ($i++ % 2 <> 0): ?>im<?php endif; ?>pair">
			<td style="text-align: center;"><?php echo sl($ligne["name"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_stock"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_used"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["total_remaining"]) ?></td>
		</tr>
		<?php $totalstock_country += $ligne["total_stock"]; ?>
		<?php $totalused_country += $ligne["total_used"]; ?>
		<?php $totaldifferential_country += $ligne["total_remaining"]; ?>
		<?php endforeach; ?>
		<tr class="total">
			<td style="text-align: center;"><?php echo trad("TOTAL", APPLNG) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_country) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_country) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_country) ?></td>
		</tr>
	</tbody>
	</table>
	
	<div class="sep"></div>
	<div style="text-align: right">
		<u><strong><?php echo trad('Exporter', APPLNG) ?></strong></u>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=par_pays&type_export=xls') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/xls.png" title="Excel" alt="Excel" /></a>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=par_pays&type_export=pdf') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/pdf.png" title="PDF" alt="PDF" /></a>
	</div>
	<div class="sep"></div>
	
	<?php foreach($this -> par_pays as $ligne): ?>
		<center>
			<?php 
				$camembert = new GP_Graph(); 
				
				$donnees = array(
					$ligne["total_used"],
					$ligne["total_remaining"]
				);
				
				$legendes = array(
					trad('Echantillons envoyés', APPLNG)." [".$ligne["total_used"]."]",
					trad('Echantillons restants', APPLNG)." [".$ligne["total_remaining"]."]"
				);
				
				$titre = trad("Etat des stocks pour", APPLNG)." ".sl($ligne["name"]);
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<?php endforeach; ?>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(
					$totalused_sample,
					$totaldifferential_sample
				); 
				
				$legendes = array(
					trad('Echantillons envoyés', APPLNG)." [".$totalused_country."]",
					trad('Echantillons restants', APPLNG)." [".$totaldifferential_country."]"
				); 
				
				$titre = trad("Etat global des stocks par pays", APPLNG);
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	
	<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('DETAILS PAR ECHANTILLON ET PAR PAYS', APPLNG) ?>&fc=0,0,0&bc=255,255,255&tp=15" alt="<?php echo trad('DETAILS PAR ECHANTILLON ET PAR PAYS', APPLNG) ?>" title="<?php echo trad('DETAILS PAR ECHANTILLON ET PAR PAYS', APPLNG) ?>" style="padding: 5px; border: solid 1px;" />
	
	<div class="sep"></div>
	
	<table class="liste">
	<thead>
		<tr>
			<th style="text-align: center;"><?php echo trad('Echantillon', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('pays', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Stock initial', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons envoyés', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons restants', APPLNG) ?></th>
		</tr>
	</thead>
	<tbody>
		<?php $detail_echantillon = array(); ?>
		<?php $i = 0; ?>
		<?php $totalstock_sample = 0; ?>
		<?php $totalused_sample = 0; ?>
		<?php $totaldifferential_sample = 0; ?>
		<?php $totalstock_sub = 0; ?>
		<?php $totalused_sub = 0; ?>
		<?php $totaldifferential_sub = 0; ?>
		<?php $old_sample = ''; ?>
		<?php foreach($this -> detail_par_echantillon as $ligne): ?>
		<?php if ($old_sample <> $ligne["sample"] && $i > 0): ?>
		<tr class="subtotal">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL POUR", APPLNG) ?> <?php echo strtoupper($old_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sub) ?></td>
		</tr>
		<?php $totalstock_sub = 0; ?>
		<?php $totalused_sub = 0; ?>
		<?php $totaldifferential_sub = 0; ?>
		<?php endif; ?>
		<?php $old_sample = $ligne["sample"] ?>
		<?php 
			$detail_echantillon[$ligne["sample"]]['pays'][] = $ligne["country"];
			$detail_echantillon[$ligne["sample"]]['stock'][] = $ligne["stock"];
			$detail_echantillon[$ligne["sample"]]['used'][] = $ligne["used"];
			$detail_echantillon[$ligne["sample"]]['remaining'][] = $ligne["remaining"];
		 ?>
		<tr class="<?php if ($i++ % 2 <> 0): ?>im<?php endif; ?>pair">
			<td style="text-align: center;"><?php echo sl($ligne["sample"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["country"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["stock"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["used"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["remaining"]) ?></td>
		</tr>
		<?php $totalstock_sample += $ligne["stock"]; ?>
		<?php $totalused_sample += $ligne["used"]; ?>
		<?php $totaldifferential_sample += $ligne["remaining"]; ?>
		<?php $totalstock_sub += $ligne["stock"]; ?>
		<?php $totalused_sub += $ligne["used"]; ?>
		<?php $totaldifferential_sub += $ligne["remaining"]; ?>
		<?php endforeach; ?>
		<tr class="subtotal">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL POUR", APPLNG) ?> <?php echo strtoupper($old_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sub) ?></td>
		</tr>
		<tr class="total">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL GLOBAL", APPLNG) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sample) ?></td>
		</tr>
	</tbody>
	</table>
	<div class="sep"></div>
	<div style="text-align: right">
		<u><strong><?php echo trad('Exporter', APPLNG) ?></strong></u>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=detail_par_echantillon&type_export=xls') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/xls.png" title="Excel" alt="Excel" /></a>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=detail_par_echantillon&type_export=pdf') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/pdf.png" title="PDF" alt="PDF" /></a>
	</div>
	
	<div class="sep"></div>
	
	<?php foreach($detail_echantillon as $nomechantillon => $subtab): ?>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['pays']) ; $i++)
				{
					$donnees[] = $subtab['stock'][$i];
					$legendes[] = $subtab['pays'][$i] . '['.$subtab['stock'][$i].']';
				}
				
				$titre = trad("Stock initial par pays pour", APPLNG) . " " . $nomechantillon;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['pays']) ; $i++)
				{
					$donnees[] = $subtab['used'][$i];
					$legendes[] = $subtab['pays'][$i] . '['.$subtab['used'][$i].']';
				}
				
				$titre = trad("Echantillons envoyés par pays pour", APPLNG) . " " . $nomechantillon;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['pays']) ; $i++)
				{
					$donnees[] = $subtab['remaining'][$i];
					$legendes[] = $subtab['pays'][$i] . '['.$subtab['remaining'][$i].']';
				}
				
				$titre = trad("Echantillons restants par pays pour", APPLNG) . " " . $nomechantillon;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<?php endforeach; ?>
	
	<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('DETAILS PAR PAYS ET PAR ECHANTILLON', APPLNG) ?>&fc=0,0,0&bc=255,255,255&tp=15" alt="<?php echo trad('DETAILS PAR PAYS ET PAR ECHANTILLON', APPLNG) ?>" title="<?php echo trad('DETAILS PAR PAYS ET PAR ECHANTILLON', APPLNG) ?>" style="padding: 5px; border: solid 1px;" />
	
	<div class="sep"></div>
	
	<table class="liste">
	<thead>
		<tr>
			<th style="text-align: center;"><?php echo trad('pays', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillon', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Stock initial', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons envoyés', APPLNG) ?></th>
			<th style="text-align: center;"><?php echo trad('Echantillons restants', APPLNG) ?></th>
		</tr>
	</thead>
	<tbody>
		<?php $i = 0; ?>
		<?php $totalstock_sample = 0; ?>
		<?php $totalused_sample = 0; ?>
		<?php $totaldifferential_sample = 0; ?>
		<?php $totalstock_sub = 0; ?>
		<?php $totalused_sub = 0; ?>
		<?php $totaldifferential_sub = 0; ?>
		<?php $old_sample = ''; ?>
		<?php $detail_pays = array(); ?>
		<?php foreach($this -> detail_par_pays as $ligne): ?>
		<?php if ($old_sample <> $ligne["country"] && $i > 0): ?>
		<tr class="subtotal">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL POUR", APPLNG) ?> <?php echo strtoupper($old_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sub) ?></td>
		</tr>
		<?php $totalstock_sub = 0; ?>
		<?php $totalused_sub = 0; ?>
		<?php $totaldifferential_sub = 0; ?>
		<?php endif; ?>
		<?php $old_sample = $ligne["country"] ?>
		
		<?php 
			$detail_pays[$ligne["country"]]['sample'][] = $ligne["sample"];
			$detail_pays[$ligne["country"]]['stock'][] = $ligne["stock"];
			$detail_pays[$ligne["country"]]['used'][] = $ligne["used"];
			$detail_pays[$ligne["country"]]['remaining'][] = $ligne["remaining"];
		 ?>
		
		<tr class="<?php if ($i++ % 2 <> 0): ?>im<?php endif; ?>pair">
			<td style="text-align: center;"><?php echo sl($ligne["country"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["sample"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["stock"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["used"]) ?></td>
			<td style="text-align: center;"><?php echo sl($ligne["remaining"]) ?></td>
		</tr>
		<?php $totalstock_sample += $ligne["stock"]; ?>
		<?php $totalused_sample += $ligne["used"]; ?>
		<?php $totaldifferential_sample += $ligne["remaining"]; ?>
		<?php $totalstock_sub += $ligne["stock"]; ?>
		<?php $totalused_sub += $ligne["used"]; ?>
		<?php $totaldifferential_sub += $ligne["remaining"]; ?>
		<?php endforeach; ?>
		<tr class="subtotal">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL POUR", APPLNG) ?> <?php echo strtoupper($old_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sub) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sub) ?></td>
		</tr>
		<tr class="total">
			<td colspan="2" style="text-align: center;"><?php echo trad("TOTAL GLOBAL", APPLNG) ?></td>
			<td style="text-align: center;"><?php echo sl($totalstock_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totalused_sample) ?></td>
			<td style="text-align: center;"><?php echo sl($totaldifferential_sample) ?></td>
		</tr>
	</tbody>
	</table>
	<div class="sep"></div>
	<div style="text-align: right">
		<u><strong><?php echo trad('Exporter', APPLNG) ?></strong></u>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=detail_par_pays&type_export=xls') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/xls.png" title="Excel" alt="Excel" /></a>
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo rw($this -> page, 'export_samples=1&w_export=detail_par_pays&type_export=pdf') ?>"><img border="0" src="<?php echo URL_SITE ?>/img/pdf.png" title="PDF" alt="PDF" /></a>
	</div>
	<div class="sep"></div>
	
	<?php foreach($detail_pays as $nompays => $subtab): ?>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['sample']) ; $i++)
				{
					$donnees[] = $subtab['stock'][$i];
					$legendes[] = $subtab['sample'][$i] . '['.$subtab['stock'][$i].']';
				}
				
				$titre = trad("Stock initial par échantillon pour", APPLNG) . " " . $nompays;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['sample']) ; $i++)
				{
					$donnees[] = $subtab['used'][$i];
					$legendes[] = $subtab['sample'][$i] . '['.$subtab['used'][$i].']';
				}
				
				$titre = trad("Echantillons envoyés par échantillon pour", APPLNG) . " " . $nompays;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<center>
			<?php 				
				$camembert = new GP_Graph(); 
				
				$donnees = array(); 
				$legendes = array();
				
				for ($i = 0 ; $i < count($subtab['sample']) ; $i++)
				{
					$donnees[] = $subtab['remaining'][$i];
					$legendes[] = $subtab['sample'][$i] . '['.$subtab['remaining'][$i].']';
				}
				
				$titre = trad("Echantillons restants par échantillon pour", APPLNG) . " " . $nompays;
				
				echo camembert($titre, $legendes, $donnees);
				
			 ?>
		</center>
	<div class="sep"></div>
	<?php endforeach; ?>
	
	<div class="sep"></div>
	
	<img style="position: relative; top: 5px;" src="<?php echo URL_SITE ?>img/back.png" alt="<?php echo trad('Retour', APPLNG) ?>" title="<?php echo trad('Retour', APPLNG) ?>" />&nbsp;&nbsp;<a href="<?php echo rw($this -> page) ?>"><?php echo trad('Retour', APPLNG) ?></a>
<?php else: ?>
<table border="0" width="100%">
<tr bgcolor="#b4b4b4">
	<td colspan="3" style="padding: 5px; text-align: center;">
		<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad(strtoupper($this -> titre), APPLNG) ?>&fc=0,0,0&bc=180,180,180&tp=20" alt="<?php echo trad($this -> titre, APPLNG) ?>" title="<?php echo trad($this -> titre, APPLNG) ?>" />
	</td>
</tr>
<tr bgcolor="#c6c6c6">
	<td width="33%" style="padding: 5px; text-align: center;">
		<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('ECHANTILLONS', APPLNG) ?>&fc=0,0,0&bc=198,198,198&tp=14" alt="<?php echo trad('ECHANTILLONS', APPLNG) ?>" title="<?php echo trad('ECHANTILLONS', APPLNG) ?>" />
	</td>
	<td width="33%" style="padding: 5px; text-align: center;">
		<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('PAYS', APPLNG) ?>&fc=0,0,0&bc=198,198,198&tp=14" alt="<?php echo trad('PAYS', APPLNG) ?>" title="<?php echo trad('PAYS', APPLNG) ?>" />
	</td>
	<td width="33%" style="padding: 5px; text-align: center;">
		<img src="<?php echo URL_SITE ?>?imgform=1&txt=<?php echo trad('ECHANTILLONS PAR PAYS', APPLNG) ?>&fc=0,0,0&bc=198,198,198&tp=14" alt="<?php echo trad('ECHANTILLONS PAR PAYS', APPLNG) ?>" title="<?php echo trad('ECHANTILLONS PAR PAYS', APPLNG) ?>" />
	</td>
</tr>
<tr bgcolor="#dfdfdf">
	<td width="33%" style="padding: 5px; text-align: center;">
		<a href="<?php echo rw('add', 'table=_fo_samples') ?>">&gt;&nbsp;<?php echo trad('Ajouter un échantillon', APPLNG) ?></a>
		<br />
		<a href="<?php echo rw('liste', 'table=_fo_samples') ?>">&gt;&nbsp;<?php echo trad('Liste des échantillons', APPLNG) ?></a>
	</td>
	<td width="33%" style="padding: 5px; text-align: center;">
		<a href="<?php echo rw('add', 'table=_fo_samples_countries') ?>">&gt;&nbsp;<?php echo trad('Ajouter un pays', APPLNG) ?></a>
		<br />
		<a href="<?php echo rw('liste', 'table=_fo_samples_countries') ?>">&gt;&nbsp;<?php echo trad('Liste des pays', APPLNG) ?></a>
	</td>
	<td width="33%" style="padding: 5px; text-align: center;">
		<a href="<?php echo rw('add', 'table=_fo_samples_by_country') ?>">&gt;&nbsp;<?php echo trad('Ajouter un échantillon pour un pays', APPLNG) ?></a>
		<br />
		<a href="<?php echo rw('liste', 'table=_fo_samples_by_country') ?>">&gt;&nbsp;<?php echo trad('Liste des échantillons par pays', APPLNG) ?></a>
		<br />
		<a href="<?php echo rw($this -> page, 'etat_stock=1') ?>">&gt;&nbsp;<?php echo trad('Etat des stocks', APPLNG) ?></a>
	</td>
</tr>
</table>
<?php endif; ?>		</div>
		<div class="sep"></div>
		<div id="footer">
			<div id="footercontenu">
				<img style="position: relative; top: 5px;" src="<?php echo URL_SITE ?>?blackttf=1&txt=© 2011<?php if(date("Y") > 2011): ?> - <?php echo date("Y") ?><?php endif; ?> - Comme des Garçons&tp=11" alt="COPYRIGHT" title="COPYRIGHT" />
			</div>
		</div>
  </body>
</html>